local hx__yanjiangli = fk.CreateSkill{
    name = "hx__yanjiangli",

    tags = {Skill.Compulsory},
}

fk.MagicDamage = 8
Fk:addDamageNature(fk.MagicDamage, "magic_damage", true)

hx__yanjiangli:addEffect(fk.BeforeHpChanged,{
  can_refresh = function(self, event, target, player, data)
    return player == target and data.damageEvent and data.damageEvent.damageType == fk.MagicDamage
  end,
  on_refresh = function (self, event, target, player, data)
    data.num = data.num - data.shield_lost
    data.shield_lost = 0
    --player.room:broadcastPlaySound("./packages/moepack/audio/card/charm_damage")
    player.room:delay(200)
  end,
})

hx__yanjiangli:addEffect(fk.DamageCaused,{
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(hx__yanjiangli.name) and target and target == player and data.damage and (data.damageType == fk.FireDamage or data.damageType == fk.MagicDamage)
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        room:changeMaxHp(data.to,-data.damage)
        room:loseHp(data.to,data.damage,hx__yanjiangli.name)
    end,
})

return hx__yanjiangli